@extends('home.layout.demo')
	<link rel="stylesheet" href="{{asset('homeCSS/zixunye/css/amazeui.min.css')}}">
  	<link rel="stylesheet" href="{{asset('homeCSS/zixunye/css/app.css')}}">
  	<link rel="stylesheet" href="{{asset('/playCSS/saved_resource')}}" type="text/css">
<link rel="stylesheet" href="{{asset('/homeCSS/zui/css/zui.min.css')}}" type="text/css">
<link rel="stylesheet" href="{{asset('/homeCSS/zui/js/zui.min.js')}}" type="text/css">

  <div style="margin-top:70px" >
		<div class="am-g   blog-content">
    		<div class="col-md-6 col-md-offset-3" style="margin-top:50px;">
     			<h1 class="am-article-title blog-text-center"><span>{{$news->title}}</span></h1>
     				<div class="am-article-bd" style="margin-left:60px;">
     					<img src="{{$news->url}}" class="blog-entry-img blog-article-margin">
     					<hr>
     				</div>
     				<!-- ============================================================================= -->
     				<div style="background: pink;height:100px;width:450px;margin-left:58px;margin-top:-80px;">
						<div style="margin-left:50px;margin-top:50px;margin-bottom:50px;">
							<!-- 资讯内容 -->
						<span style="font-size:16px;color:red;">资讯内容:</span>{{$news->content}}
						</div>
					</div>
					<!-- ============================================================================== -->
			</div>
		</div>
	</div>

	
	<input type="hidden" id="nid" value="{{$news->id}}">
<!-- =================================================================================================== -->

 @if(session('uid'))<div class="course-subcontainer clearfix" style="margin-top:20px; margin-left:20px; width:900px;">
	  <div class="course-left" style="margin-left:120px;">
	      <ul class="course-menu course-video-menu clearfix js-course-menu" data-ower="all" data-sort="last" style="position: absolute; left: 0px;">
	    <li class="course-menu-item">
	    	<a class="active" href="javascript:void(0)" id="plMenu">评论</a>
	    </li>
	       </ul>
	<div id="disArea" class="lists-container list-wrap" >
	    <div id="pl-content" class="list-tab-con">
 				<div class="publish clearfix" id="discus-publish">
	            	<div class="publish-wrap publish-wrap-pl">
	                <div class="pl-input-wrap clearfix">
	                    <a href="#" class="user-head l">
	                        {!! \App\Http\Controllers\ShareController::share() !!}
	                    </a>
	                    <div id="js-pl-input-fake" class="pl-input-inner l">
	                       <textarea id="js-pl-textarea" class="js-placeholder" placeholder="扯淡、吐槽、表扬、鼓励……想说啥就说啥！"></textarea>
	                       <span class="num-limit"><span id="js-pl-limit">0</span>/300</span>
	                    </div>
	                    <div class="pl-input-btm input-btm clearfix">
	                        <div class="verify-code l"></div>
	                        <input type="button" id="js-pl-submit" class="r course-btn" value="发表评论">
	                    </div>
	                </div>

	            </div>
	        </div>
	@else<div class="course-subcontainer clearfix" style="margin-top:20px; margin-left:20px; width:900px;">
	  <div class="course-left" style="margin-left:120px; ">
	      <ul class="course-menu course-video-menu clearfix js-course-menu" data-ower="all" data-sort="last" style="position: absolute; left: 0px;">
	    <li class="course-menu-item">
	    	<a class="active" href="javascript:void(0)" id="plMenu">评论<span style="margin-left:300px;color:red;font-size:15px;margin-bottom:50px;">亲,登录才能评论呦</span></a>

	    </li>
	       </ul>
	<div id="disArea" class="lists-container list-wrap">
	    <div id="pl-content" class="list-tab-con">
	
	@endif
	 			
	 			
	 		<div id="ping" style="background: #fff;">
				@foreach($ncomment as $k=>$v)
		        <div id="lun" class="pl-container" > <ul>   
			        <li class="pl-list clearfix"> 
				        <div class="pl-list-avator"> 
					        <a href="#" target="_blank">
					          <img id="vimg" width="40" height="40" src="{{$v->portrait}}" title="DanielP">
					        </a>
					    </div>
					    <div class="pl-list-main">
						         <div class="pl-list-nick"> 
						           <a class="vuser" href="#" target="_blank">{{$v->nickname}}</a> 
					        	 </div>
							<div class="vmessage" class="pl-list-content">{{$v->message}}
							</div>
						           <div class="pl-list-btm clearfix"> 
							           <span id="vtime" class="pl-list-time l">
							           	<!-- 时间判断 -->
							           	<!-- ================================================== -->
							           	<span class="pl-list-time l">
							           	@if(time()-$v->time>='0'&& time()-$v->time<'60') 时间:{{time()-$v->time}}秒前
							           	@elseif(time()-$v->time>='60' && time()-$v->time<'3600') 时间:{{ltrim(date('i',(time()-$v->time)),'0')}}分钟前
							           	@elseif(time()-$v->time>='3600' && time()-$v->time<'43200') 时间:{{date('h',time()-$v->time)}}小时前
							           	@else 时间:{{date('m月d日',$v->time)}}
							           	@endif	
							           	</span>
							           	<!-- ==================================================== -->
							           </span>  
							          
						           </div> 
				           	</div>
			           </li> 
		        </div>
		         @endforeach
		    </div>  
		   
		    </div>
	    </div>
	   </div>
	   </div>
	   <script type="text/javascript" src="{{asset('/homeCSS/js/jquery-1.8.3.min.js')}}"></script>
	   <script>
	     //用户名绑定丧失焦点事件
	     $('#js-pl-submit').click(function(){
	     

	      		 if($('#js-pl-textarea').val() != ''){
	      		   //发送ajax把评论插入数据库
	      		   var inp = $('#js-pl-textarea');

	      		   $.ajax({
	      		     url:'/home/zixun/comment',
	      		     data:{comment:inp.val(),nid:$('#nid').val()},
	      		     type:'get',
	      		     success:function(data){
	      		     	
	      		       	//在控制器中返回视图
	      		         $('#ping').prepend(data);
	      		     },
	      		     async:false
	      		   })
	      		 }else{
	      		 
	       		alert('评论不能为空');  
	      		 }
	     })
	   </script>
	  </div>